package com.osdp.common.base;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * jwt payload内的信息定义
 */
@Data
public class JWTInfo implements Serializable {

    private String userId;

    private String userName;
    //是否超级管理员 如果是超级管理员，则不过滤租户信息，全部租户的信息可看。
    private boolean superAdmin = false;
    //当前登陆所属租户，该字段仅仅是管理平台才有用，因为管理平台需要根据当前租户，加载出当前租户下的信息。
    private String nowTenant;
    //租户ID集合
    List<String> tenants;

    List<String> roles;

    List<String> permissions;

    public JWTInfo(){}

    public JWTInfo(String userId, String userName, boolean superAdmin, String nowTenant) {
        this.userId = userId;
        this.userName = userName;
        this.superAdmin = superAdmin;
        this.nowTenant = nowTenant;
    }

    public JWTInfo(String userId, String userName, boolean superAdmin, String nowTenant, List<String> tenants, List<String> roles) {
        this.userId = userId;
        this.userName = userName;
        this.superAdmin = superAdmin;
        this.nowTenant = nowTenant;
        this.tenants = tenants;
        this.roles = roles;
    }
}
